CheckBoxes in a cfgrid

This is an old example that we made for a presentation that we gave to the Michigan user group. It shows how to check and uncheck checkBoxes in a cfgrid. Once you have a least one item checked, you can remove it from the grid. A confirmation pops up before the action gets executed just in case. Then you need to submit the form to see the results.

Checkboxes in a cfgrid


This is an old example that we made for a presentation that we gave to the Michigan user group. It shows how to check and uncheck checkBoxes in a cfgrid. Once you have a least one item checked, you can remove it from the grid. A confirmation pops up before the action gets executed just in case. Then you need to submit the form to see the results.

Checkboxes in a cfgrid

var contactList = contactList; var console = console; var confirm = function (evt) { if (evt.detail == mx.controls.Alert.OK) { for(var i:Number = contactList.length-1; i >= 0; i--) { var item:Object = contactList.dataProvider[i]; if(item.checked.toString() == "true") { contactList.selectedIndex = i; GridData.deleteRow(contactList); } } } } alert("Are you sure you want to remove the checked records?", "Warning", mx.controls.Alert.OK | mx.controls.Alert.CANCEL, confirm); if(selectBtn.label == "Check all") { for(var i:Number = 0; i < contactList.length; i++) { contactList.editField(i, "checked", "true"); } selectBtn.label = "Uncheck all"; } else if(selectBtn.label == "Uncheck all") { for(var i:Number = 0; i < contactList.length; i++) { contactList.editField(i, "checked", "false"); } selectBtn.label = "Check all"; }

View live example
Download the source